local __all_category_list__ = {
	{
		name = "motion",
		text = "运动",
		color = "#2E9BEF",
		blocktypes = {"Move", "TurnRight", "TurnLeft", "MoveTo", "X", "Y"},
	},
	{
		name = "looks",
		text = "外观",
		color = "#76CE62",
		blocktypes = {"Say"},
	}
}

local __all_block_list__ = {
	{
		type = "Move",
		message = "移动 %1 步",
        arg = {
            {
                type = "input_value",
                name = "step",
                value = "10",
            },
        },
		category = "motion",
        output = false,
        previousStatement = true,
        nextStatement = true,
		toCode = "Move(${step})",
	},
	{
		type = "TurnRight",
		message = "右转 %1 度",
		arg = {
			{
				type = "input_value",
				value = "15",
				name = "degree"
			}
		},
		category = "motion",
        output = false,
        previousStatement = true,
        nextStatement = true,
		toCode = "TurnRight(${degree})",
	},
	{
		type = "TurnLeft",
		message = "左转 %1 度",
		arg = {
			{
				type = "input_value",
				value = "15",
				name = "degree"
			}
		},
		category = "motion",
        output = false,
        previousStatement = true,
        nextStatement = true,
		toCode = "TurnLeft(${degree})",
	},
	{
		type = "MoveTo",
		message = "移到 %1",
        arg = {
            {
                type = "field_select",
                name = "pos",
                value = "random_position",
				options = {
					{"随机位置", "random_position"},
					{"鼠标位置", "mouse_position"},
				}
            },
        },
		category = "motion",
        output = false,
        previousStatement = true,
        nextStatement = true,
		toCode = "MoveTo([[${pos}]])",
	},
	{
		type = "X",
		category = "motion",
		message = "X坐标",
		arg = {},
		output = true,
		previousStatement = false,
		nextStatement = false,
		toCode = "GetX()",
	},
	{
		type = "Y",
		category = "motion",
		message = "Y坐标",
		arg = {},
		output = true,
		previousStatement = false,
		nextStatement = false,
		toCode = "GetY()",
	},
	{
		type = "Say",
		message = "说 %1 %2 %3 秒",
		arg = {
			{
				type = "field_space",
				value = 2,
			},
			{
				type = "input_value",
				name = "text",
				value = "你好!",
			}, 
			{
				type = "input_value",
				name = "time",
				value = "2"
			}
		},
		category = "looks",
        output = false,
        previousStatement = true,
        nextStatement = true,
		toCode = "Say([==[${text}]==], ${time})",
	}
	-- {
	-- 	type = "direction",
	-- 	message = "方向",
	-- 	arg = {},
	-- 	output = true,
	-- 	previousStatement = false,
	-- 	nextStatement = false,
	-- },
	-- {
	-- 	type = "print",
	-- 	message = "打印 %1 册数",
	-- 	arg = {
	-- 		{
	-- 			type = "field_input",
	-- 			name = "value",
	-- 			text = "这是测试"
	-- 		}
	-- 	},
	-- 	output = false,
	-- 	previousStatement = true,
	-- 	nextStatement = true,
	-- }, 
	-- {
	-- 	type = "if",
	-- 	message = "如果 %1 那么 %2",
	-- 	arg = {
	-- 		{
	-- 			type = "field_input",
	-- 			name = "condition"
	-- 		},
	-- 		{
	-- 			type = "input_statement",
	-- 			name = "code"
	-- 		}
	-- 	},
    --     output = false,
	-- 	previousStatement = true,
	-- 	nextStatement = true,
	-- },
	-- {
	-- 	type = "if_else",
	-- 	message = "如果 %1 那么 %2 否则 %3",
	-- 	arg = {
	-- 		{
	-- 			type = "field_input",
	-- 			name = "condition",
	-- 			text = "真"
	-- 		},
	-- 		{
	-- 			type = "input_statement",
	-- 			name = "true_code",
	-- 		},
	-- 		{
	-- 			type = "input_statement",
	-- 			name = "false_code",
	-- 		},
	-- 	},
    --     output = false,
	-- 	previousStatement = true,
	-- 	nextStatement = true,
	-- },
}

local __all_category_map__ = {};
for _, category in ipairs(__all_category_list__) do
	__all_category_map__[category.name] = category;
end

local __all_block_map__ = {};
for _, block in ipairs(__all_block_list__) do
	__all_block_map__[block.type] = block;
end

return {
	__all_block_list__ = __all_block_list__,
	__all_block_map__ = __all_block_map__,
	__all_category_list__ = __all_category_list__,
	__all_category_map__ = __all_category_map__,
}